from django.shortcuts import render
class Person(object):
    def __init__(self,username):
        self.username = username

def index(request):
    # p = Person("老王")
    # context = {
    #     "Person":p
    # }
    # context = {
    #     "Persons":[
    #         '孙悟空',
    #         '啥武警',
    #         '牛魔王'
    #     ]
    # }
    #判断
    # context = {
    #     "age":17
    # }

    # context = {
    #     "book": [
    #         '孙悟空',
    #         '啥武警',
    #         '牛魔王'
    #     ]
    # }
    # context = {
    #     "book": [
    #         '孙悟空',
    #         '啥武警',
    #         '牛魔王'
    #     ],
    #     'perpon' : {
    #         'username':"skx",
    #         'age': 18,
    #         'password': 'qqq'
    #
    #         }
    #     }

    context = {
        'books': [
            {
                'name':'三国演义',
                'author':'罗贯中',
                'pricr':199
            },
            {
                'name': '西游记',
                'author': '吴承恩',
                'pricr': 122
            },
            {
                'name': '水浒传',
                'author': 'shinaian',
                'pricr': 133
            }

        ],
        'comments':[

        ]
    }
    return render(request,'index.html',context=context)